package com.zr.gdms.serviceimpl;

import com.zr.gdms.dao.TeacherDao;
import com.zr.gdms.daoimpl.TeacherDaoImpl;
import com.zr.gdms.service.AdminTeacherService;

import net.sf.json.JSONObject;
/**
 * 管理员查询教师服务实现层
 * @author 李培宁
 *
 */
public class AdminTeacherServiceImpl implements AdminTeacherService{

	TeacherDao tdao = new TeacherDaoImpl();
	@Override
	public JSONObject getAllTeachers(int page, int rows) {
		JSONObject j = new JSONObject();
		j.put("total", tdao.findTeachersCount());
		j.put("rows", tdao.findAllTeachers(page, rows));
		return j;
	}
	@Override
	public boolean insertTeacher(String tname,String tage,String tdepart,String tprofe,String tsex,String ttel) {
		// TODO Auto-generated method stub
		return tdao.insertTeacher(tname, tage, tdepart, tprofe, tsex, ttel);
	}
	@Override
	public boolean updateTeacher(String tname,String tage,String tdepart,String tprofe,String tsex,String ttel,int tid) {
		// TODO Auto-generated method stub
		return tdao.updateTeacher(tname, tage, tdepart, tprofe, tsex, ttel, tid);
	}
	@Override
	public boolean deleteTeacher(String apptype, String appstate) {
		// TODO Auto-generated method stub
		return tdao.deleteTeacher(apptype, appstate);
	}
	@Override
	public JSONObject searchTeacher(int page, int rows, int tid, String tname) {
		JSONObject jo = new JSONObject();
		jo.put("total", tdao.findTeachersCount());
		jo.put("rows", tdao.searchTeachers(page, rows, tid, tname));
		return jo;
	}

	

}
